package files_controller;
import java.io.*;

public class Find implements ICommandExecutor{
	public void execute(String string){
		
		String[] str_mas = string.split(" ");
		String path = str_mas[1];
		String search_word = str_mas[2];
		File folder = new File(path);
		if(!folder.exists()){
			System.out.println("Directory not found: " + path);
		} else{
			File[] list = folder.listFiles();
			for(File file : list){
				if((file.getName().contains(search_word))==true){
					if(file.isDirectory())  System.out.println("<dir> " + file.getName());
					else if(file.isFile())  System.out.println("<file> " + file.getName());
				}
			}
		}		
	}

}
